<template>
  <div class="E1MM_top">
    <setQChart></setQChart>
    <div class="E1MMT_tx"><tx></tx></div>
    <div class="E1MMT_name">
      <input type="text" class="E1MMTN_disabled" v-focus v-if="!isDisabled" v-model="value" @blur="noDisabled()">
      <span class="E1MMTN_disabled" v-if="isDisabled">{{value}}</span>
      <img src="../../../../static/staticJC/images/event/pencil.png" alt="" @click="disabled()">
    </div>
  </div>
</template>

<script>
  import vue from 'vue'
  import setQChart from './setQChart.vue'
  import tx from './tx.vue'
  export default {
    data(){
      return {
        isDisabled:true,
        value:"战队名称"
      }
    },
    components:{
      setQChart,
      tx
    },
    methods:{
      disabled(){
        this.isDisabled = false;
      },
      noDisabled(){
        let name = this.value;
        this.isDisabled = true;
        this.setValue(name);
      },
      setValue(name){
        let $this = this;
        let data;
        if(name != undefined){
          data = {teamName:name};
        }else{
          data = null
        }
        ajaxCore.ajax(config.szg.teamNameInfo, data, "POST", {
          "Authorization": getToken()
        }).done(function (res) {
          if(res.status === 10001){
            $this.value = res.result;
          }
        });
      }
    },
    mounted() {
      this.setValue();
    }
  }

</script>
